@extends('admins.layouts.default')
@section('content')
<div class="col-lg-12">
	<div class="panel panel-default">
		<div class="panel-heading">
			List Post
		</div>
		<div class="panel-body">
			<div class="row">
				<div class="col-lg-6">

					<p>{{ link_to_route('admin.post.create', 'Add new') }}</p>
					
					@if ($posts)
						<div class="table-responsive">
						    <table class="table table-striped table-bordered table-hover">
						        <thead>
									<tr>
						                <th>Title</th>
								        <th>Content</th>
						            </tr>
						        </thead>
						        <tbody>
						            @foreach ($posts as $post)
						       			<tr>
						                    <td>{{ $post->title }}</td>
									        <td>{{ $post->content }}</td>
						                    <td>{{ link_to_route('admin.post.edit', 'Edit', $post->id, ['class' => 'btn btn-info']) }}</td>
						                    <td>
						          				{{ Form::open(['method' => 'DELETE', 'route' => ['admin.post.destroy', $post->id]]) }}
						                            {{ Form::submit('Delete', ['class' => 'btn btn-danger']) }}
						                        {{ Form::close() }}
						                    </td>
						                </tr>
						            @endforeach
						        </tbody>
						    </table>
						</div>
						<div class="pagination">{{ $posts->appends(array('sort' => 'votes'))->links() }}</div>
					@else
					    There are no posts
					@endif
				
				</div>
				<!-- /.col-lg-6 -->
			</div>
			<!-- /.row -->
		</div>
		<!-- /.panel-body -->
	</div>
	<!-- /.panel -->
</div>
<!-- /.col-lg-12 -->
@stop